# $Id: PKGBUILD 86164 2013-03-12 14:35:37Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Sean Timothy Noonan <stnoonan@obsolescence.net>

pkgname=postgrey
pkgver=1.34
pkgrel=11
pkgdesc="a Postfix policy server implementing greylisting"
arch=('any')
url="http://postgrey.schweikert.ch/"
options=(emptydirs)
license=("GPL")
depends=('perl-net-server' 'perl>=5.6.0' 'perl-berkeleydb' 'perl-io-multiplex' 'db>=4.1')
optdepends=('postfix: the recommended MTA for use with postgrey'
	    'exim: an alternative MTA'
	    'perl-net-dns: for postgreyreport tool')
backup=(etc/postfix/postgrey_whitelist_recipients
	etc/postfix/postgrey_whitelist_clients
	etc/conf.d/postgrey)
install=$pkgname.install
source=($url/pub/$pkgname-$pkgver.tar.gz
	postgrey.rc
	postgrey.rc.conf
	postgrey.service
	postgrey.tmpfiles)
md5sums=('f736a7be1094593f1a66cd13f32b39ef'
         '44c97de44f1245cafb0cbe2704f65a3d'
         '93c5b0632a4284ee3c1e0a1e30bf0a6b'
         '4ce8d15d7fdf744567948a47aaf5254a'
         '3236959f435c95db3a13f4c7dd235609')

package() {
  cd $srcdir/$pkgname-$pkgver
  chown -R root:root .
  mkdir -p $pkgdir/var/spool/postfix/postgrey
  install -D -m 0755 $srcdir/postgrey.rc $pkgdir/etc/rc.d/postgrey
  install -D -m 0644 $srcdir/postgrey.rc.conf $pkgdir/etc/conf.d/postgrey
  install -D -m 0755 postgrey $pkgdir/usr/sbin/postgrey
  install -D -m 0755 contrib/postgreyreport $pkgdir/usr/sbin/postgreyreport
  install -D -m 0644 postgrey_whitelist_recipients $pkgdir/etc/postfix/postgrey_whitelist_recipients
  install -D -m 0644 postgrey_whitelist_clients $pkgdir/etc/postfix/postgrey_whitelist_clients

  install -Dm0644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
  install -Dm0644 $srcdir/$pkgname.tmpfiles $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
}
